#include "../include/CDefaultShotBehaviour.h"
#include "../include/CSprite.h"


//**************************
//Description : Constructor
//Parameters : Value for m_iX, m_iY,
//              m_iSpeedX, m_iSpeedY,
//              m_iWidth, m_iHeight,
//              the ratio of the collision box
//              the type of collision
//              m_iPowerShot
//Note : None
//**************************
CDefaultShotBehaviour::CDefaultShotBehaviour(int _iX, int _iY,
                                            int _iSpeedX , int _iSpeedY,
                                            int _iWidth, int _iHeight,
                                            float _fRatioW, float _fRatioH,
                                            TYPE_COLLISION _iTypeCollision,
                                            int _iPowerShot)
    : IDefaultEntityBehaviour(_iX, _iY,
                                _iSpeedX, _iSpeedY,
                                _iWidth, _iHeight,
                                _fRatioW, _fRatioH,
                                _iTypeCollision),
    m_iPowerShot(_iPowerShot)
{
    m_ShotSprite = NULL;
}


//**************************
//Description : Copy Constructor
//Parameters : A CDefaultShotBehaviour
//Note : None
//**************************
CDefaultShotBehaviour::CDefaultShotBehaviour(CDefaultShotBehaviour & _DefaultShot)
    : IDefaultEntityBehaviour(_DefaultShot),
    m_iPowerShot(_DefaultShot.m_iPowerShot)
{
    m_ShotSprite = new CSprite(*_DefaultShot.m_ShotSprite);
}

//**************************
//Description : Destructor
//Parameters : None
//Note : None
//**************************
CDefaultShotBehaviour::~CDefaultShotBehaviour()
{
    if ( m_ShotSprite != NULL )
        delete m_ShotSprite;
}

//**************************
//Description : Return the power shot
//Parameters : None
//Return Value : The power shot
//Note : None
//**************************
int CDefaultShotBehaviour::GetPowerShot() const
{
    return m_iPowerShot;
}

//**************************
//Description : Return the sprite of the shot
//Parameters : None
//Return Value : The sprite
//Note : None
//**************************
CSprite* CDefaultShotBehaviour::GetSprite() const
{
    return m_ShotSprite;
}

//**************************
//Description : Set the sprite of the shot
//Parameters : The pointer tooward the animation and the screen
//Return Value : None
//Note : None
//**************************
void CDefaultShotBehaviour::SetSprite(CSpriteAnimation * _SpriteAnimationShot, SDL_Surface * _screen)
{
    if (m_ShotSprite == NULL)
        m_ShotSprite = new CSprite(_SpriteAnimationShot, _screen);
}

//**************************
//Description : Update the trajectory of the entity
//Parameters : None
//Return Value : None
//Note : None
//**************************
void CDefaultShotBehaviour::EntityTrajectory()
{
    m_iX += m_iSpeedX;
    m_iY += m_iSpeedY;
}
